<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }
        .div1 {
            position: relative;
            /*
                居中， translateX里面的百分比是盒子自身的宽度百分比
            */
            left: 50%;
            transform: translateX(-50%);

            width: 100px;
            height: 100px;
            background-color: #ccc;
        }
        .behind {
            width: 300px;
            height: 300px;
            background-color: #1acd7e;
        }
    </style>
</head>
<body>
    <div class="div1"></div>
    <div class="behind"></div>
</body>
</html>